import { defineConfig } from 'vite'
import { fileURLToPath } from 'url'

const resolve = dir => fileURLToPath(new URL(dir, import.meta.url))

export default defineConfig({
	server: {
		host: '0.0.0.0',
		port: 8099,
		open: true,
		cors: true,
		fs: {
			strict: false,
		},
	},
	plugins: [],
	resolve: {
		alias: {
			'@': resolve('./src'),
			'~': resolve('./'),
		},
	},
	build: {
		terserOptions: {
			compress: {
				//生产环境时移除console
				drop_console: true,
				drop_debugger: true,
			},
		},
		// 取消计算文件大小，加快打包速度
		reportCompressedSize: false,
		sourcemap: true,
	},
})
